﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Comissoes.Models.NCM>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <%= ViewData["scripts"] %>
    <!-- JS Custom -->
    <script type="text/javascript" src="../../Scripts/cadastros/ncm.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#tUFRegimeTributario").jqGrid({
                datatype: 'json',
                url: '/NCM/UFRegimeTributarioList',
                mtype: 'GET',
                colNames: ['Id', 'Regime Tributário', 'UF', 'MVA', 'Redução', 'Alíquota'],
                colModel: [
                    { name: 'ID_NURT', index: 'ID_NURT', width: 80, sortable: false, align: 'right', search: false, hidden: true },
                    { name: 'ID_RGTR', index: 'ID_RGTR', width: 140, editable: true, edittype: 'select', editoptions: { value: "<%= Comissoes.Utilities.Formats.RegimesTributarios() %>"} },
                    { name: 'SIGLA_UF', index: 'SIGLA_UF', width: 50, editable: true, edittype: 'select', editoptions: { value: "<%= Comissoes.Utilities.Formats.UFs() %>"} },
                    { name: 'MVA_NURT', index: 'MVA_NURT', width: 80, align: 'right', editable: true, searchoptions: { sopt: ['cn', 'eq']} },
                    { name: 'REDUCAO_NURT', index: 'REDUCAO_NURT', width: 80, align: 'right', editable: true, searchoptions: { sopt: ['cn', 'eq']} },
                    { name: 'ALIQUOTA_NURT', index: 'ALIQUOTA_NURT', width: 80, align: 'right', editable: true, searchoptions: { sopt: ['cn', 'eq']} }
                ],
                altRows: false,
                pager: '#pUFRegimeTributario',
                height: 'auto',
                width: 500,
                rowNum: 15,
                rowList: [5, 10, 15, 20],
                sortname: 'SIGLA_UF',
                sortorder: "asc",
                autowidth: false,
                viewrecords: true,
                viewsortcols: true,
                gridview: true,
                multiselect: false,
                postData: {
                    ID_NCM: function () { return $('#ID_NCM').val(); }
                },
                ondblClickRow: function (id) {
                    editRow('tUFRegimeTributario', '/NCM/UFRegimeTributarioUpdate', id, { ID_NCM: $('#ID_NCM').val() });
                }
            }).navGrid("#pUFRegimeTributario", {
                edit: false, add: false, del: false, search: false, refresh: true
            }).navButtonAdd("#pUFRegimeTributario", {
                caption: '',
                buttonicon: 'ui-icon-circle-plus',
                onClickButton: function () {

                },
                title: "adicionar cnae",
                position: "last"
            });
        });
    </script>
</head>
<body>
    <div class="cabecalho ui-state-highlight">
        <span class="icodtl" />
        <span class="txt">
            <%= Html.Encode("Detalhes do NCM") %>
        </span>
    </div>
    <fieldset class="container transparent">
        <label class="input80">
            <button type="button" class="documentcommand" onclick="loadOption('/NCM/Edit', true);">Nova</button>
        </label>
        <label class="input80">
            <button class="pencilcommand" type="button" onclick="Edit('NCM', 'ID_NCM', true)">Editar</button>
        </label>
        <label class="input80">
            <button class="listcommand" type="button" onclick="List('NCM', true)">Retornar</button>
        </label>
    </fieldset>
    <fieldset class="resizable container field580 border ui-widget-content ui-corner-all">
        <fieldset class="container field560 transparent">
            <%= Html.Hidden("ID_NCM", Model.ID_NCM) %>

            <%= Html.Label("for80", "Código:") %>
            <%= Html.Label("for100 ui-state-default right", Html.Encode(Model.COD_NCM)) %>

            <%= Html.Label("ATIVO_NCM", "for340 right", "Ativo") %>
            <%= Html.LabelInput(Html.CheckBox("ATIVO_NCM", Model.ATIVO_NCM == "A", new { disabled = true }), "Check") %>

            <%= Html.Label("for80 clear", "Descrição:") %>
            <%= Html.Label("for460 ui-state-default", Model.DESC_NCM) %>
            
            <fieldset class="also container field540 float">
                <div class="Accordion">
	                <h3><a href="#">UF - Regimes Tributários</a></h3>
	                <div>
	                    <table id="tUFRegimeTributario"></table>
                        <div id="pUFRegimeTributario"></div>
	                </div>
                </div>
            </fieldset>
    </fieldset>
</body>
</html>